package com.service;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;

import com.dao.Archive;
import com.pojo.Archivepojo;
import com.pojo.Userspojo;
import com.util.MySqlSessionFactory;

public class ArchiveService {
	SqlSession sql = MySqlSessionFactory.getSqlSession();
	Archive dao = sql.getMapper(Archive.class);

	public void add(String archive_id, String identity, String name,
			String gender, String brithday, String date_retire1,
			String date_retire2, String sp, String fc, String title,
			String seniority) {
		dao.add(archive_id, identity, name, gender, brithday, date_retire1,
				date_retire2, sp, fc, title, seniority);
		sql.commit();
	}

	public List<Archivepojo> queryone(String search) {
		List<Archivepojo> map = dao.queryone(search);
		return map;
	}

	public List<Map<String, Object>> query(String id) {
		List<Map<String, Object>> map = dao.query(id);
		return map;
	}

	public void update(@Param("id") String id, String name, String gender,
			String brithday, String date_retire1, String date_retire2,
			String sp, String fc, String title, String seniority) {
		dao.update(id, name, gender, brithday, date_retire1, date_retire2, sp,
				fc, title, seniority);
		sql.commit();
	}

	public List<Archivepojo> infol(@Param("id") String id) {

		return dao.infol(id);

	}

	public List<Map> queryall(String archive_id, String identity, String name,
			String gender, String brithday, String date_retire1,
			String date_retire2, String sp, String fc, String title,
			String seniority) {
		return dao.queryall(archive_id, identity, name, gender, brithday,
				date_retire1, date_retire2, sp, fc, title, seniority);
	}

	public List<Map> queryjin(String user_id) {
		return dao.queryjin(user_id);
	}

	public List<Map> queryliu(String user_id) {
		return dao.queryliu(user_id);
	}
}
